Systems and methods for flushing a cache with modified data

ABSTRACT

Systems and methods for flushing a cache with modified data are disclosed. Responsive to a request to flush data from a cache with modified data to a next level cache that does not include the cache with modified data, the cache with modified data is accessed using an index and a way and an address associated with the index and the way is secured. Using the address, the cache with modified data is accessed a second time and an entry that is associated with the address is retrieved from the cache with modified data. The entry is placed into a location of the next level cache.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. application Ser. No. 15/353,053, filed Nov. 16, 2016, which application is a continuation of U.S. patent application Ser. No. 13/531,491, filed Jul. 30, 2012, which are herein incorporated by reference in their entirety.

A cache in a central processing unit is a data storage structure that is used by the central processing unit of a computer to reduce the average time that it takes to access memory. It is a memory which stores copies of data that is located in the most frequently used main memory locations. Cache memory is memory that is smaller in storage capacity than main memory but is memory that can be accessed much more quickly.

A cache is considered to be full when it does not have space available to accommodate incoming data. When a cache is full, writes to the cache can be prevented from proceeding. Accordingly, write stalls can occur until a successful write-back or flushing of data that is maintained in the cache is executed and space is created to accommodate the incoming data.

Cache flushing removes an entry or entries from the cache such that space is freed for incoming data. The removal can be from the cache to a next level cache. This can be done either manually or automatically.

Some conventional caches are organized such that the contents of a lower level cache are contained in a next higher level cache. Such organization can provide performance advantages and disadvantages. However, some higher level caches may not include the contents of the lower level cache. In particular, the cache line entries of a lower level cache with modified data may not be included in the next level cache. A problem can arise when cache line entries of a cache with modified data that are not included in a next level cache needs to be flushed from the cache with modified data to the next level cache. If a lower level cache is included in a higher level cache, it is enough to flush the higher level cache to the next higher level cache (relative to itself) or main memory. When a lower level cache is not included in a higher level cache, the flush operation of this higher level cache cannot simultaneously effect the flushing of the lower level cache as well.

A conventional approach to flushing cache line entries from a cache with modified data to a next level cache in such circumstances is to stop the traffic on one of the ports of the cache with modified data and to inject flush requests from that port to write-back cache line entries from the cache with modified data one index and way at a time. However, this approach can have adverse timing impacts and has the potential to degrade performance. In addition, this approach can require a complex implementation.

SUMMARY

Conventional approaches to flushing data from a cache with modified data to a next level cache can have adverse timing impacts that can degrade performance. In addition, such approaches can require a complex implementation. A method for flushing data from a lower level cache (a cache with modified data in one embodiment) to a higher level (e.g., a next level cache) is disclosed that addresses these shortcomings. However, the claimed embodiments are not limited to implementations that address any or all of the aforementioned shortcomings. As a part of the method, responsive to a request to flush data from a cache with modified data to a next level cache that does not include the cache with modified data, the cache with modified data is accessed using an index and a way to secure the address associated with that index and the way. Using this address, the cache with modified data is accessed a second time and an entry that is associated with the address is retrieved from the cache with modified data. The entry is placed into a location of the next level cache. The aforementioned methodology does not negatively impact timing or degrade performance. In addition, the methodology is amenable to a straightforward implementation.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention, together with further advantages thereof, may best be understood by reference to the following description taken in conjunction with the accompanying drawings in which:

FIG. 1A shows an exemplary operating environment of a system for flushing a cache with modified data according to one embodiment.

FIG. 1B illustrates, responsive to a request to access a level two cache, the accessing of a store coalescing cache using an index and a way to obtain an address corresponding to data that is to be flushed to a level two cache according to one embodiment.

FIG. 1C illustrates operations performed by a system for flushing a cache with modified data according to one embodiment.

FIG. 2 shows components of a system for flushing a cache with modified data according to one embodiment.

FIG. 3 shows a flowchart of the steps performed in a method for flushing a cache with modified data according to one embodiment.

It should be noted that like reference numbers refer to like elements in the figures.

DETAILED DESCRIPTION

Although the present invention has been described in connection with one embodiment, the invention is not intended to be limited to the specific forms set forth herein. On the contrary, it is intended to cover such alternatives, modifications, and equivalents as can be reasonably included within the scope of the invention as defined by the appended claims.

In the following detailed description, numerous specific details such as specific method orders, structures, elements, and connections have been set forth. It is to be understood however that these and other specific details need not be utilized to practice embodiments of the present invention. In other circumstances, well-known structures, elements, or connections have been omitted, or have not been described in particular detail in order to avoid unnecessarily obscuring this description.

References within the specification to “one embodiment” or “an embodiment” are intended to indicate that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. The appearance of the phrase “in one embodiment” in various places within the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Moreover, various features are described which may be exhibited by some embodiments and not by others. Similarly, various requirements are described which may be requirements for some embodiments but not other embodiments.

Some portions of the detailed descriptions, which follow, are presented in terms of procedures, steps, logic blocks, processing, and other symbolic representations of operations on data bits within a computer memory. These descriptions and representations are the means used by those skilled in the data processing arts to most effectively convey the substance of their work to others skilled in the art. A procedure, computer executed step, logic block, process, etc., is here, and generally, conceived to be a self-consistent sequence of steps or instructions leading to a desired result. The steps are those requiring physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of electrical or magnetic signals of a computer readable storage medium and are capable of being stored, transferred, combined, compared, and otherwise manipulated in a computer system. It has proven convenient at times, principally for reasons of common usage, to refer to these signals as bits, values, elements, symbols, characters, terms, numbers, or the like.

It should be borne in mind, however, that all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless specifically stated otherwise as apparent from the following discussions, it is appreciated that throughout the present invention, discussions utilizing terms such as “accessing” or “identifying” or “placing” or the like, refer to the action and processes of a computer system, or similar electronic computing device that manipulates and transforms data represented as physical (electronic) quantities within the computer system's registers and memories and other computer readable media into other data similarly represented as physical quantities within the computer system memories or registers or other such information storage, transmission or display devices.

Exemplary Operating Environment of a System for Flushing a Cache with Modified Data According to One Embodiment

FIG. 1A shows an exemplary operating environment 100 of a system 101 for flushing a cache with modified data according to one embodiment. System 101 directs, in response to a periodic request to flush data from a cache with modified data to a next level cache that does not include the cache with modified data, an access of the cache with modified data based on an index and way to secure (e.g., identify) an address associated with the data to be flushed. Subsequently, the address is used to access the cache with modified data a second time to obtain the data to be flushed, which is then written into a location (e.g., index) of the next level cache. FIG. 1A shows system 101, L1 cache 103, L1 store coalescing cache 103 a (e.g., cache with modified data), load cache 103 b, CPU 105, L2 cache 107 (e.g., next level cache), L2 cache controller 107 a, main memory 109 and system interface 111. It should be appreciated that store coalescing cache 103 a is termed “cache with modified data” as it maintains data that can be modified by stores that update or modify the data.

Referring FIG. 1A, L1 cache 103 is a level 1 cache and L2 cache 107 is a level 2 cache. In one embodiment, L1 cache 103 includes store coalescing cache 103 a and load cache 103 b. Store coalescing cache 103 a maintains entries that are accessed by store request and load cache 103 b maintains entries that are accessed by load requests. In one embodiment, store coalescing cache 103 a is a part of L1 cache 103 but is not included in L2 cache 107 (e.g., the next level cache). Requests to flush data from store coalescing cache 103 a to L2 cache 107 which are received by L2 cache 107 involve obtaining an address from store coalescing cache 103 a before store coalescing cache 103 a can be probed for the information associated with the address. In one embodiment, the access of store coalescing cache 103 a is facilitated by a probe that couples L2 cache 207 and store coalescing cache 103 a (see FIG. 1B).

In one embodiment, because store coalescing cache 103 a is not included in L2 cache 107, requests to flush store coalescing cache 103 a to L2 cache 107 can cause stalls in the absence of a mechanism for facilitating the acquisition by L2 cache 107 of information that is needed to flush data from store coalescing cache 103 a to L2 cache 107. In one embodiment, this mechanism is provided by system 101, which as a part of its operation directs a securing of information from store coalescing cache 103 a that is needed to access store coalescing cache 103 a at the pipeline speed of L2 cache 107. In one embodiment, L2 cache 107 controls the probe that is used to access and read data from store coalescing cache 103 a.

Referring to FIG. 1B, system 101, responsive to a request to flush data from store coalescing cache 103 a to L2 cache 107, directs a probe of store coalescing cache 103 a using an index and a way to secure an address corresponding to data that is to be flushed to L2 cache 107 (see arrows corresponding to pipeline in FIG. 1B). In one embodiment, the access of store coalescing cache 103 a is facilitated by probe 113 that is controlled by L2 cache 107. As a result of the probe, the address is provided to L2 cache 107. Then, the address is used to probe store coalescing cache 103 a a second time to obtain the data that is to be flushed from store coalescing cache 103 a. Thereafter, the data is written to L2 cache 107 (see arrows corresponding to pipeline). In one embodiment, as shown in FIG. 1A, based on the operation of system 101, data is accessed and flushed from store coalescing cache 103 a at the speed of the L2 cache pipeline. In one embodiment, system 101 can be located in cache controller 107 a. In other embodiments, system 101 can be separate from cache controller 107 a, but operate cooperatively therewith.

Referring again to FIG. 1A, main memory 109 includes physical addresses that store the information that is copied into cache memory. In one embodiment, when the information that is contained in the physical addresses of main memory that have been cached is changed, the corresponding cached information is updated to reflect the changes made to the information stored in main memory. Also shown in FIG. 1A is system interface 111.

Operation

FIG. 1C illustrates operations performed by a system for flushing a cache with modified data according to one embodiment. These operations, which relate to flushing a cache with modified data are illustrated for purposes of clarity and brevity. It should be appreciated that other operations not illustrated by FIG. 1C can be performed in accordance with one embodiment.

Referring to FIG. 1C, at A, a request to flush data that is present in a cache with modified data (e.g., store coalescing cache 103 a in FIG. 1A) that corresponds to a specific address is received.

At B, a probe of the cache with modified data (e.g., store coalescing cache 103 a in FIG. 1A), using the index and way where the data is located in the cache with modified data, is executed.

At C, the address in the cache with modified data (e.g., store coalescing cache 103 a in FIG. 1A) residing at the aforementioned index and way is secured (e.g., identified) and provided to a next level cache (e.g., L2 cache 107 in FIG. 1A).

At D, the address is used to probe the cache with modified data a second time to obtain the data associated with the address.

At E, the data associated with the address in the cache with modified data is obtained and provided to the next level cache.

At F, the data is placed into a location of the next level cache. In one embodiment, the flushing of a cache with modified data can be done periodically while the cache is idling and no stores are incoming.

Components of System for Flushing a Cache with Modified Data According to One Embodiment

FIG. 2 shows components of a system 101 for flushing a cache with modified data according to one embodiment. In one embodiment, components of system 101 implement an algorithm for flushing a cache with modified data. In the FIG. 2 embodiment, components of system 101 include flush request accessor 201, cache probe 203 and writing component 205.

Flush request accessor 201 accesses a request to flush data from a cache with modified data to a next level cache. In one embodiment, the request can be one of an on-going series of periodic requests to flush data from the cache with modified data. In one embodiment, the flushing of data from the cache with modified data can be done to free up space for newer data based on the expectation that newer data will be received. In one embodiment, the request is directed to the next level cache (e.g., an L2 cache).

Cache probe 203, responsive to the request to flush data from a cache with modified data, accesses (e.g., probes) the cache with modified data using an index and a way and identifies an address associated with the index and way. Subsequently, using the address, cache probe 203 accesses (e.g., probes) the cache with modified data a second time and retrieves data that is located at the location that is indicated by the index and way.

Writing component 205 places the data that is retrieved into a location of the next level cache. In one embodiment, the contents of the cache with modified data are not included in the next level cache and thus before an entry (e.g., cache line entry with data) from the cache with modified data can be flushed to the next level cache, the address associated with the entry is obtained such that the entry can be identified and flushed to the next level cache and placed into a location there as a new entry.

It should be appreciated that the aforementioned components of system 101 can be implemented in hardware or software or in a combination of both. In one embodiment, components and operations of system 101 can be encompassed by components and operations of one or more computer components or programs (e.g., cache controller 107 a in FIG. 1A). In another embodiment, components and operations of system 101 can be separate from the aforementioned one or more computer components or programs but can operate cooperatively with components and operations thereof.

Method for Flushing a Cache with Modified Data According to One Embodiment

FIG. 3 shows a flowchart 300 of the steps performed in a method for flushing a cache with modified data according to one embodiment. The flowchart includes processes that, in one embodiment can be carried out by processors and electrical components under the control of computer-readable and computer-executable instructions. Although specific steps are disclosed in the flowchart, such steps are exemplary. That is the present embodiment is well suited to performing various other steps or variations of the steps recited in the flowchart.

Referring to FIG. 3, at 301, a request to flush data from a cache with modified data to a next level cache is accessed. In one embodiment, the request can be one of an on-going series of periodic requests that flush data from the cache with modified data.

At 303, responsive to the request, a cache with modified data is accessed using an index and a way. In one embodiment, the index and way is used because the address associated with the desired entry is not available.

At 305, an address associated with said index and said way is secured (e.g., identified) from the cache with modified data. The securing of the address enables a subsequent retrieval of the entry associated with the address.

At 307, using the address, the cache with modified data is accessed a second time. In one embodiment, the access of the cache with modified data (in both 305 and 307) is executed using a probe that is controlled by the next level cache.

At 309, data is retrieved that is associated with the address. And, at 311, the data is written into a location of the next level cache.

With regard to exemplary embodiments thereof, systems and methods for flushing a cache with modified data are disclosed. Responsive to a request to flush data from a cache with modified data to a next level cache that does not include the cache with modified data, the cache with modified data is accessed using an index and a way and an address associated with the index and the way is secured. Using the address, the cache with modified data is accessed a second time and an entry that is associated with the address is retrieved from the cache with modified data. The entry is placed into a location of the next level cache.

Although many of the components and processes are described above in the singular for convenience, it will be appreciated by one of skill in the art that multiple components and repeated processes can also be used to practice the techniques of the present invention. Further, while the invention has been particularly shown and described with reference to specific embodiments thereof, it will be understood by those skilled in the art that changes in the form and details of the disclosed embodiments may be made without departing from the spirit or scope of the invention. For example, embodiments of the present invention may be employed with a variety of components and should not be restricted to the ones mentioned above. It is therefore intended that the invention be interpreted to include all variations and equivalents that fall within the true spirit and scope of the present invention. 

What is claimed is:
 1. A method for flushing a cache with modified data, the method comprising: receiving a request to flush modified data from a first cache to a second cache; accessing the first cache using an index and way associated with the modified data; identifying an address of the modified data in the first cache based on the index and way associated with the modified data; providing the address of the modified data to the second cache; and accessing the first cache to retrieve the modified data using the address.
 2. The method of claim 1, further comprising: writing the modified data to a location within the second cache.
 3. The method of claim 2, wherein the modified data is retrieved from first cache and written to the location of the second cache at the pipeline speed of the second cache.
 4. The method of claim 1, wherein the second cache is at a higher level in a cache hierarchy than the first cache.
 5. The method of claim 1, wherein the modified data is not included in the second cache.
 6. The method of claim 1, wherein the second cache uses a cache probe to access the first cache using the index and way associated with the modified data, identify the address of the modified data in the first cache based on the index and way associated with the modified data, and retrieve the modified data using the address.
 7. The method of claim 1, wherein accessing the first cache to retrieve the modified data is performed by the second cache and in response to receiving the address of the modified data.
 8. A processor, comprising: a central processing unit; a first cache; and a second cache that includes a cache controller that includes: a flush request controller to process a request to flush modified data from the first cache to a second cache, and a cache probe to: access the first cache using an index and way associated with the modified data, identify an address of the modified data in the first cache based on the index and way associated with the modified data, and access the first cache to retrieve the modified data using the address.
 9. The processor of claim 8, wherein the cache controller further comprises: a writing component to write the modified data to a location within the second cache.
 10. The processor of claim 9, wherein the modified data is retrieved from first cache and written to the location of the second cache at the pipeline speed of the second cache.
 11. The processor of claim 8, wherein the second cache is at a higher level in a cache hierarchy than the first cache.
 12. The processor of claim 8, wherein the modified data is not included in the second cache.
 13. The processor of claim 8, wherein the cache probe is to access the first cache to retrieve the modified data in response to receiving the address of the modified data from the first cache.
 14. A non-transitory machine-readable medium that stores instructions, which when executed by a processor causes the processor to: process a request to flush modified data from a first cache to a second cache; access the first cache using an index and way associated with the modified data; identify an address of the modified data in the first cache based on the index and way associated with the modified data; provide the address of the modified data to the second cache; and access the first cache to retrieve the modified data using the address.
 15. The non-transitory machine-readable medium of claim 14, wherein the instructions further cause to the processor to: write the modified data to a location within the second cache.
 16. The non-transitory machine-readable medium of claim 15, wherein the modified data is retrieved from first cache and written to the location of the second cache at the pipeline speed of the second cache.
 17. The non-transitory machine-readable medium of claim 14, wherein the second cache is at a higher level in a cache hierarchy than the first cache.
 18. The non-transitory machine-readable medium of claim 14, wherein the modified data is not included in the second cache.
 19. The non-transitory machine-readable medium of claim 14, wherein the second cache uses a cache probe to access the first cache using the index and way associated with the modified data, identify the address of the modified data in the first cache based on the index and way associated with the modified data, and retrieve the modified data using the address.
 20. The non-transitory machine-readable medium of claim 14, wherein accessing the first cache to retrieve the modified data is performed by the second cache and in response to receiving the address of the modified data. 